/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.ArrayList;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Nordinator
 */
@Entity
@Table(name="ARTISTE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Artiste.findAll", query = "SELECT a FROM Artiste a"),
    @NamedQuery(name = "Artiste.findByName", query = "SELECT a FROM Artiste a WHERE a.name = :name")})
public class Artiste implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String name;
    //Cette fonction contient l'id des albums
    private ArrayList<String> discographie;
    
    public Artiste(){
        
    }
    
    public Artiste(String name){
        this.name = name;
        discographie = new ArrayList<String>();
    }
    

    /**
     * Get the value of discographie
     *
     * @return the value of discographie
     */
    public ArrayList<String> getDiscographie() {
        return discographie;
    }

    /**
     * Set the value of discographie
     *
     * @param discographie new value of discographie
     */
    public void setDiscographie(ArrayList<String> discographie) {
        this.discographie = discographie;
    }

    public void addAlbum(String album){
        discographie.add(album);
    }
    /**
     * Get the value of Name
     *
     * @return the value of Name
     */
    public String getName() {
        return name;
    }

    /**
     * Set the value of Name
     *
     * @param Name new value of Name
     */
    public void setName(String Name) {
        this.name = Name;
    }


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Artiste)) {
            return false;
        }
        Artiste other = (Artiste) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Artiste[ id=" + id + " ]";
    }
    
}
